package com.realtyManage.springboot.Dao;


import com.realtyManage.springboot.Model.Do.IndexHotHouse;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IndexHotHouseRepository extends JpaRepository<IndexHotHouse, Integer>, JpaSpecificationExecutor<IndexHotHouse> {

    List<IndexHotHouse> findByArea(String area);

    List<IndexHotHouse> findByAreaLike(String area);

    @Query(value = "select * from hot_house where area not like %?1% ", nativeQuery = true)
    List<IndexHotHouse> findByAreaNotLike(String area);

    @Query(value = "select id from house_detail where periphery like %?1% ", nativeQuery = true)
    List<Integer> findByPeripheryLike(String area);

    @Query(value = "select periphery from house_detail where id = ?1 ", nativeQuery = true)
    String findHouseId(String houseId);

    /**
     *  获取周边楼盘详细信息ID
     * @param code
     * @return
     */
    @Query(value = "select id from house_detail where area like %?1% ", nativeQuery = true)
    String findLikeArea(String code);


}
